package com.qysxy.feign.service.user.fallback;

import com.qysxy.api.user.UserDto;
import com.qysxy.feign.service.user.IUserService;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * Created by MisterDeng on 2018/4/18/018 10:02.
 */
@Component
public class IUserServiceFallbackFactory implements FallbackFactory<IUserService> {

    @Override
    public IUserService create(Throwable throwable) {
        return new IUserService() {
            @Override
            public UserDto home() {
                UserDto dto = new UserDto();
                dto.setName("调用失败，feign进行降级处理");
                return dto;
            }

            @Override
            public String order() {
                return "调用失败，feign进行降级处理";
            }

            @Override
            public String result() {
                return "调用失败，feign进行降级处理";
            }
        };
    }
}
